//
//  LeftMVControlCollectionViewItem.m
//  Rongcloud
//
//  Created by LiuLinhong on 2017/08/18.
//  Copyright © 2017年 Beijing Rongcloud Network Technology Co. , Ltd. All rights reserved.
//

#import "LeftMVControlCollectionViewItem.h"

@interface LeftMVControlCollectionViewItem ()

@end

@implementation LeftMVControlCollectionViewItem

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)reloadCollectionViewItem:(NSDictionary *)dic
{
    NSString *imageName = dic[@"image"];
    self.itemImageView.image = [NSImage imageNamed:imageName];
    
    self.itemLabel.stringValue = dic[@"title"];
    self.view.wantsLayer = YES;
    
    if ( ([self.itemLabel.stringValue isEqualToString:NSLocalizedString(@"meeting_hungup", nil)] && [dic[@"item"] integerValue] == 8))
    {
        self.view.layer.backgroundColor = [NSColor redColor].CGColor;
        self.itemLabel.textColor = [NSColor whiteColor];
    }
    else
    {
        //        if ([dic[@"enable"] integerValue] == 0)
        //            self.view.layer.backgroundColor = [NSColor lightGrayColor].CGColor;
        //        else
        //            self.view.layer.backgroundColor = [NSColor whiteColor].CGColor;
        
        //        self.view.layer.backgroundColor = ([dic[@"enable"] integerValue] == 0) ? [NSColor lightGrayColor].CGColor : [NSColor whiteColor].CGColor;
        
        self.view.layer.backgroundColor = [NSColor whiteColor].CGColor;
        
        if ([dic[@"enable"] integerValue] == 0)
            self.itemLabel.textColor = [NSColor lightGrayColor];
        else if ([dic[@"enable"] integerValue] == 1)
            self.itemLabel.textColor = [NSColor blackColor];
        else if ([dic[@"enable"] integerValue] == 2)
            self.itemLabel.textColor = kThemeColor;
    }
}

- (void)enableButton
{
    self.itemLabel.textColor = [NSColor blackColor];
}

- (void)disableButton
{
    self.itemLabel.textColor = [NSColor lightGrayColor];
}




@end
